from config.config import config


def partition_interval():
    """
    区间划分:左闭右开
    :return:
    """
    CONDITIONS = config["handler"]["conditions"]
    minVal = CONDITIONS[0]
    maxVal = CONDITIONS[1]
    interval = CONDITIONS[2]
    groupCount = int((maxVal - minVal) / interval)
    # print(dataSet[attr])
    ans = []
    for i in range(0, groupCount):
        leftMargin = round(minVal + interval * i, 3)
        rightMargin = round(leftMargin + interval, 3)
        key = "%.3f_%.3f" % (leftMargin, rightMargin)
        ans.append(key)
    # start = maxVal - interval
    # ans.append("%.3f_%.3f" % (start, 1.000))
    return ans


if __name__ == "__main__":
    # condition = [0.0, 1.0, 0.05]
    ans = partition_interval()
    print(ans)
